<template>
    <div>
        <el-drawer title="" :visible.sync="drawer" :direction="direction" :before-close="handleClose" custom-class="drawer-info">
            <div class="info-item">
                <h5 class="from-title">基本信息</h5>
                <div class="form-item">
                    <label class="form-item-label">升级方式（订单完成后、付款后）:</label>
                    <div class="form-item-content">{{ objInfo.upModeName }}</div>
                </div>
                <div class="form-item">
                    <label class="form-item-label">是否开启账户充值:</label>
                    <div class="form-item-content">{{ objInfo.rechargeStatusName }}</div>
                </div>
                <div class="form-item">
                    <label class="form-item-label">是否开启余额提现:</label>
                    <div class="form-item-content">{{ objInfo.withdrawalStatusName }}</div>
                </div>
                <div class="form-item">
                    <label class="form-item-label">余额提现方式:</label>
                    <div class="form-item-content">{{ objInfo.withdrawalMethodName }}</div>
                </div>
                <div class="form-item">
                    <label class="form-item-label">最小提现金额（余额满多少才能提现,空或0不限制）:</label>
                    <div class="form-item-content">{{ objInfo.withdrawalMin }}
                    </div>
                </div>
                <div class="form-item">
                    <label class="form-item-label">余额提现手续费(%):</label>
                    <div class="form-item-content">{{ objInfo.withdrawalServiceCharge }}
                    </div>
                </div>
                <div class="form-item">
                    <label class="form-item-label">免手续费金额 开始金额:</label>
                    <div class="form-item-content">{{ objInfo.withdrawalFreeStart }}
                    </div>
                </div>
                <div class="form-item">
                    <label class="form-item-label">免手续费金额 结束金额:</label>
                    <div class="form-item-content">{{ objInfo.withdrawalFreeEnd }}
                    </div>
                </div>
            </div>
        </el-drawer>
    </div>
</template>
<script>
    import { membersetingInfo } from "@/api/member/memberseting.js";
    import { dictList,enumList, } from "@/api/public.api.js";
    export default {
        data() {
            return {
                drawer: true,
                direction: "rtl",
                objInfo: {},
                withdrawList:[],
                MemberUpModeList:[],
                YesNoList:[],
            }
        },
        created() {
        },
        methods: {
          queryDictList(){
              this.withdrawList = [];
              dictList("withdraw").then((resp) => {
                if (resp.code == 0) {
                  this.withdrawList = resp.data;
                }
              });
          },
          queryEnumList(){
              this.MemberUpModeList = [];
              enumList("MemberUpMode","").then((resp) => {
                if (resp.code == 0) {
                  this.MemberUpModeList = resp.data;
                }
              });
              this.YesNoList = [];
              enumList("YesNo","").then((resp) => {
                if (resp.code == 0) {
                  this.YesNoList = resp.data;
                }
              });
          },
            init(id) {
                this.queryDictList();
                this.queryEnumList();
                if (id) {
                   membersetingInfo(id).then(res => {
                        this.objInfo = res.data
                              let upModeObj = this.MemberUpModeList.find((item) => {
                                return item.code == this.objInfo.upMode;
                              });
                              this.objInfo.upModeName = upModeObj ? upModeObj.name : "";
                              let rechargeStatusObj = this.YesNoList.find((item) => {
                                return item.code == this.objInfo.rechargeStatus;
                              });
                              this.objInfo.rechargeStatusName = rechargeStatusObj ? rechargeStatusObj.name : "";
                              let withdrawalStatusObj = this.YesNoList.find((item) => {
                                return item.code == this.objInfo.withdrawalStatus;
                              });
                              this.objInfo.withdrawalStatusName = withdrawalStatusObj ? withdrawalStatusObj.name : "";
                              let withdrawalMethodObj = this.withdrawList.find((item) => {
                                return item.code == this.objInfo.withdrawalMethod;
                              });
                              this.objInfo.withdrawalMethodName = withdrawalMethodObj ? withdrawalMethodObj.name : "";
                   })

                }
                this.drawer = true
            },
            // 关闭抽屉
            handleClose(done) {
                done()
            },
        },
    }
</script>
<style scoped>
    .from-title {
        margin-bottom: 20px;
        padding: 0 20px 20px 20px;
        font-size: 16px;
        color: #17233d;
        border-bottom: 1px solid #eee;
    }
    .info-item {
        margin-bottom: 40px;
    }

    .form-item {
        margin-bottom: 20px;
        font-size: 14px;
    }
    .form-item-label {
        text-align: right;
        float: left;
        width: 25%;
    }
    .form-item-content {
        margin-left: 30%;
        width: 70%;
    }
</style>
